<?php

Yii::import('application.models._base.BaseCollegeDetails');

class CollegeDetails extends BaseCollegeDetails {

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    public function rules() {
        return array(
//            array('name_of_institution, name_of_the_head_institution, address, distict_name, pin_code, phone_number, phone_number_1, name_of_university_bord, university_type, std_code_phone, std_code_phone1, states_id, student_details_id', 'required'),
      array('college_email, name_of_the_head_institution,  phone_number', 'required'),
            array('college_email', 'email',),
            array('states_id', 'numerical', 'integerOnly' => true),
            array('phone_number', 'numerical', 'integerOnly' => true),
            array('name_of_institution, name_of_the_head_institution, distict_name, college_email, university_type', 'length', 'max' => 245),
            array('pin_code', 'length', 'max' => 8),
            array('phone_number, phone_number_1', 'length', 'max' => 10),
            array('name_of_university_bord', 'length', 'max' => 250),
            array('std_code_phone, std_code_phone1', 'length', 'max' => 5),
            array('student_details_id', 'length', 'max' => 20),
            array('near_police_station_address', 'safe'),
            array('college_email, near_police_station_address', 'default', 'setOnEmpty' => true, 'value' => null),
            array('id, name_of_institution, name_of_the_head_institution, address, distict_name, pin_code, phone_number, phone_number_1, college_email, name_of_university_bord, university_type, std_code_phone, std_code_phone1, near_police_station_address, states_id, student_details_id', 'safe', 'on' => 'search'),
        );
    }

    public function relations() {
        return array(
            'states' => array(self::BELONGS_TO, 'States', 'states_id'),
            'studentDetails' => array(self::BELONGS_TO, 'StudentPersonalDetails', 'student_details_id'),
        );
    }

}